Skip to content

Adds USPS completion page and wires up USPS confirmation form#1421

Merged
el-mapache merged 1 commit intomasterfrom
ab-restyle-usps-confirmation
May 18, 2017
Merged

Adds USPS completion page and wires up USPS confirmation form#1421
el-mapache merged 1 commit intomasterfrom
ab-restyle-usps-confirmation

Conversation

@el-mapache
Copy link
Contributor

@el-mapache el-mapache commented May 9, 2017

This PR adds a confirmation page and fixes up the confirmation form in which the user enters the OTP code they received in the mail, when selecting USPS verification.

Confirmation screen:
screen shot 2017-05-09 at 11 05 05 am

Code confirmation form:
screen shot 2017-05-11 at 8 35 22 am

Manual testing is a bit cumbersome:

1). Sign in / create an account via a service provider (LOA3)
2). Fill in all the personal info, select USPS delivery
3). Enter your password, confirm your personal key
4). Manually go to /account (necessary because of an existing bug)
5). Click the pending profile alert
6). In your rails console, find your user, decrypt your pii and copy the otp code
7. Enter that code into the form on step 6
8. View the confirmation page

I'm marking this as ready for review although I suspect there will be some cleanup to do

EDIT: I added a screenshot for the confirmation page. I also tried to make it clearer that two pages were updated.

@el-mapache el-mapache self-assigned this May 9, 2017
@el-mapache el-mapache force-pushed the ab-restyle-usps-confirmation branch from 4103878 to 3ae6947 Compare May 9, 2017 18:40
@esgoodman
Copy link
Contributor

@rtwell I think we need to remove either the top flash banner from this OR remove the descriptive copy. Seeing the screenshot, I am tempted to remove the descriptive copy and move the flash banner down (see below), but that leaves us without an H1 for the page. What are your thoughts?

17c-wf- confirmation

@el-mapache el-mapache force-pushed the ab-restyle-usps-confirmation branch from 3ae6947 to 4c18d42 Compare May 9, 2017 20:28
@rtwell
Copy link

rtwell commented May 9, 2017

i like the H1 and no banner, personally. it also lines up with the comps for this: https://github.com/18F/identity-private/issues/1443

fyi, @hursey013 and i are going to open an issue to revisit our type scale (hopefully in sprint 32?), so don't let the uncomfortable type sizes deter. done is better than perfect!

@el-mapache
Copy link
Contributor Author

@rtwell sweet, I will update the PR!

@rtwell
Copy link

rtwell commented May 9, 2017

also, don't we need to tell folks what attributes will be shared here?

@el-mapache
Copy link
Contributor Author

el-mapache commented May 9, 2017

I don't think so? It wasn't on any of the mocks.

Edit: That I saw

@rtwell
Copy link

rtwell commented May 9, 2017

the more i think about this screen, the more i dont see why we cant use the same screen, attributes and all, from https://github.com/18F/identity-private/issues/1443.

these users are now no different than a user that successfully verified online, correct?

@el-mapache
Copy link
Contributor Author

el-mapache commented May 9, 2017

I think this screen is shown post account creation, so the user will have already been notified about what personal information is going to be shared with the partner agencies?

@rtwell
Copy link

rtwell commented May 9, 2017

hmmmm we should confirm that. @andrewhughey @esgoodman can you advise?

@esgoodman
Copy link
Contributor

esgoodman commented May 9, 2017

The issue is not so much when the account is created but when the attributes get shared with our partner. In the verify-by-mail case, the user can't sign in -- and hence the attributes are not going to be shared -- until the account is verified by entering a valid confirmation code from the letter.

TLDR; we should have the attributes on this page as in #1143. We will use the body text from #1143 as suggested.

@rtwell, can you confirm the final styles for @el-mapache? #1143 has a bunch of different mockups.

@andrewhughey
Copy link
Contributor

I'm pretty comfortable with how this has been implemented given how the issue was originally outlined. I'd rather create new issues to work through the design concerns above than keep this PR open.

Let's focus here on the code review and we'll handle the rest elsewhere. Thanks @el-mapache!

@el-mapache el-mapache force-pushed the ab-restyle-usps-confirmation branch 2 times, most recently from 9cd6340 to b414d4a Compare May 10, 2017 20:14
@monfresh
Copy link
Contributor

It looks like there is some overlap here with #1369. I would suggest waiting until that gets merged, then rebasing this PR against that.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about making these analytics changes in a separate PR? They don't seem directly related to adding a USPS confirmation page, and I think this requires more thought about what distinction we want to make here. IdV completion could immediately follow user registration for example.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha. Makes sense to maintain two separate events. I'll take it out

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this logic will need to be moved to the VerifyProfileConcern once #1369 is merged.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, this assumes that the initial SP request is still in the session, but in all likelihood, it will not be, since by the time the user receives the letter, the session will have expired, so when they sign back in, session[:sp] will not be present, and redirecting them to sign_up_completed_url will take them to the account page.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the USPS confirmation flow, we provide the user with a URL that points back to the service provider, so in theory there should be an sp session preset at all times. Obviously the user could elect not to enter the URL and instead go directly to the site. I spoke with Liz about it and she seemed to think it was unlikely the user wouldn't follow the instructions on the letter.

But, we won't know for sure until we test is out with users.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, on my way in to work, I realized I was wrong about this scenario not being likely. Even if the instructions didn't include a URL, the user could potentially go to the SP directly, then after they sign in on login.gov, they will be prompted to confirm their account, and at that point, the SP info will be in the session.

I think it's still worth it to have tests for both scenarios: one where the SP info is in the session, and one where it is not.

Also, I'm curious how the "URL that points back to the service provider" works. Where can I see an example of that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry that was worded really badly; but the idea is that the confirmation letter is going to direct the user to go back to the service provider's URL. It should be in the invision docs linked in the github issue

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would the no sp session scenario be better off in a separate PR? To generate the redirect url and service provider name we'll need additional behavior, I guess using the identity model? That is, assuming that we always want to show the user the completion page.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, a separate PR is fine. I'll open an issue to discuss how we want to handle this scenario.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method doesn't seem to be used anywhere.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we explicitly making a distinction between the USPS confirmation code and other security codes? For example, we have otp_incorrect: Security code is incorrect, but here we are changing the language. Is that intentional?

Copy link
Contributor Author

@el-mapache el-mapache May 11, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did change the language intentionally. The new designs, which I'll be linking in a moment, called for it.

config/routes.rb Outdated
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these being used?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, will remove!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean sign_up_completed_url?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean sign_up_completed_path?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you explain the reason for modifying the loa3_sp_session method? It looks like you're using the same issuer it was using before. If the reason was to set a request_url in the session in order to test that when you click "continue" on the completions page it takes you back to the SP, may I suggest that we don't need that test since the completions page and controller are already tested? The main thing we're concerned with here is to make sure that USPS confirmation takes the user to the completions page.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test assumes that the USPS confirmation is performed in a session where SP info is still present, which is not a likely scenario. What do you think about modifying this spec such that the SP session is not present?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per my above comment, its expected to be a likely scenario. I agree it would be good to have a fallback but am not 100% sure what that would look like right now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I modified it for test purposes, I'll remove the parameter.

@el-mapache el-mapache changed the title Adds USPS Confirmation page Adds USPS Confirmation page and wires up USPS confirmation May 11, 2017
@el-mapache el-mapache changed the title Adds USPS Confirmation page and wires up USPS confirmation Adds USPS completion page and wires up USPS confirmation form May 11, 2017
@el-mapache el-mapache force-pushed the ab-restyle-usps-confirmation branch from 2d858f9 to bb51a2f Compare May 11, 2017 19:24
@monfresh
Copy link
Contributor

For the LOA3 spec, I would recommend simulating an actual LOA3 request and putting the test in spec/features/saml/loa3. That way, it's a true integration test.

@el-mapache el-mapache force-pushed the ab-restyle-usps-confirmation branch from bb51a2f to 612fda8 Compare May 15, 2017 18:17
@el-mapache el-mapache force-pushed the ab-restyle-usps-confirmation branch 2 times, most recently from d3758f3 to a59352f Compare May 15, 2017 20:00
@el-mapache
Copy link
Contributor Author

@monfresh I've rebased this onto 1369. I updated the USPS loa3 spec at features/saml/loa3_sso_spec to continue through the confirmation page and back to to original request URL.

I added a next_step method to the verify/account controller. In the case of openid the user needs to be redirected to whatever path is generated by after_sign_in_for, and in all other cases (from what I can tell) the user should get redirected to the sign_up_completed route.

If you think we can better address this by extending the after_sign_in_for method and/or adding a concern for openid, let me know.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean to add this here? Perhaps this was an unintentional consequence of the rebase with master? This line doesn't exist in master.

Copy link
Contributor Author

@el-mapache el-mapache May 16, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see now, it did exist in master when I opened the PR, but was moved in 1369 to the profile maker class. I'll remove it!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this test is going through SamlIdpController, it should not be necessary to stub the session. In fact, it's discouraged because it might be masking a bug. We want to simulate the user experience as closely as possible.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting, I added this because I could not get the test to pass at all. The value of sp_session was always an empty object.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about moving this spec to spec/features/saml and using a real SAML request as opposed to stubbing the session? This will ensure a more authentic end to end test.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We would also need to have the same test in spec/features/openid_connect to make sure it works there too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The spec should be in openid_connect already, on line 280.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm slightly confused, the spec already exists in saml, it is the test you commented on ☝️ . Do you want me to completely remove this scenario from flow_spec and just rely on the 'live' tests?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh. I didn't realize that. If it's exactly the same test, then yes, we only want the "live" one.

Copy link
Contributor Author

@el-mapache el-mapache May 16, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The two specs aren't exactly the same, as the flow_spec example verifies immediately after the profile is created. I don't think that matters much though, as that scenario is guaranteed to never happen in real life.

EDIT: On second though, it is probably worth it to test going through the IdV flow and clicking on 'send letter'. Both the saml and openid specs manually set the deactivation_reason attribute and don't hit that page.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, but I think we only need one test that uses SAML and goes through everything as a user would.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recently learned about a neat trick where you can reference an existing translation inside another one. Since "Resend confirmation instructions" is defined in idv.messages.usps.send_again, you can refer to it by add a colon before it, like this:

You can click :idv.messages.usps.send_again to get another one.

Magic!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No way!! I was thinking it was odd that there wasn't anyway to reuse these strings.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually can't get this to work. From previous searches I've seen using & as an alias, but I can't find references to prefixing a translation key with a : to share them.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strange. It worked for me. I tested by running a spec that loads this page and I added a screenshot_and_save_page, and I saw the translated text.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and you put in exactly what you pasted here? I see the string as presented here, with the : prefix, uninterpolated

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad. I was looking at the wrong page. I just realized this change is not related to this PR. It looks like it's just cleaning up whitespace. It turns out that to use this magic trick, the only thing you can put as the value is the key you are referencing, like this:

confirmation_period_expired: :idv.messages.usps.send_again

So, it doesn't look like we can use it here 😢

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh bummer 😞

@el-mapache el-mapache force-pushed the ab-restyle-usps-confirmation branch from 6377363 to f868e88 Compare May 16, 2017 16:45
@el-mapache
Copy link
Contributor Author

@monfresh I removed the test from flow_spec and put it into saml/loa3_sso_spec.

@el-mapache el-mapache force-pushed the ab-restyle-usps-confirmation branch 2 times, most recently from bdcac61 to 31d0488 Compare May 16, 2017 22:59
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand why OpenID Connect users would not be presented with the completions page. Could you explain that to me please?

Copy link
Contributor Author

@el-mapache el-mapache May 17, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@monfresh the openid connect flow takes the user to a different page after they verify their code, which is determined by the after_sign_in_path_for method. Ideally I'd like to just use that everywhere, but I don't want to refactor that method in the context of this PR.

We may also need to update the openid connect flow, as we now have different styles for the 'shared attributes' pages. This flow also bypasses the current completions page.

For reference, here is a screenshot from openid_connect spec on line 280:
screen shot 2017-05-17 at 9 23 30 am

As for why users are taken to a different page, I'm not sure! I guess the requirements weren't exactly in sync? We hadn't really nailed down the LOA3 verification flow either. In any case, it is probably worth opening up a ticket to address this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My understanding is that we are getting rid of this screen, so might as well do it here, at least for this scenario. By "getting rid of it", I mean always redirect to sign_up_completed_url and don't include any logic for OIDC.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean to stop the test here? Don't we want to test all the way through to seeing the completions page and then continuing to the SP?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I stopped it because the user will never be able to go all the way through the flow when they first register. There is a second test beginning at line 141 that checks that the user is able to return and finish the verification process.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I get that, but they are still able to do more on the site, right? Once on the verify/confirmations page, they will acknowledge their personal key, and after that, they should be sent to the account page, where they should see a message about needing to confirm their USPS code.

I suggest we merge #1424 (I approved it last night. It just needs to be squashed), then rebase this PR against master so we can properly test the whole flow as the user would experience it.

@el-mapache el-mapache force-pushed the ab-restyle-usps-confirmation branch from 31d0488 to 630af13 Compare May 17, 2017 18:25
@monfresh monfresh force-pushed the ab-restyle-usps-confirmation branch from def689a to 9080bc6 Compare May 17, 2017 19:51
@el-mapache el-mapache force-pushed the ab-restyle-usps-confirmation branch from 9080bc6 to 218c1f4 Compare May 17, 2017 20:05
@monfresh
Copy link
Contributor

@el-mapache Looks like your rebase with master is causing these latest test failures. It's just some I18n stuff that needs to be updated in the tests.

@el-mapache el-mapache force-pushed the ab-restyle-usps-confirmation branch from 218c1f4 to 806a0bc Compare May 17, 2017 20:43
@el-mapache
Copy link
Contributor Author

@monfresh errors fixed!

@monfresh
Copy link
Contributor

This is starting to shape up nicely! 2 more tests and we should be good to go:

  1. Clicking "Send another letter" when prompted to enter USPS code. Is it expected that the user has to enter their password and then get a new personal key in this scenario?

  2. Clicking "I can't get mail at this address". Currently, in this PR, clicking that link refreshes the account/verify page. I'm assuming it should be going to the phone activation page instead.

@el-mapache
Copy link
Contributor Author

@monfresh So, those two routes don't actually behave as expected right now. The original issue included making these pages behave properly but it seemed like too much to tackle. I believe there are two additional issues open to handle those two links.

@monfresh
Copy link
Contributor

Gotcha. In that case, what do you think about removing those links from this PR since they are not hooked up right?

@el-mapache
Copy link
Contributor Author

Yeah, I think that's reasonable

@monfresh
Copy link
Contributor

Approved! Please remember to squash before merging.

**Why**: To better match our designs.

Add verify/completion controller, route, view+test

**Why**: To Let the user know their account was verified and activated
successfully, and to provide a simple mechanism for the user to return
to the service provider

Removes uneeded duplicate controller

**Why**: Made changes to `completions_controller` to
accomodate either loa3 or loa1 signups

Remove vestigal test code, undeed route logic

**Why**: USPS test now ends once user has gotten to the completion
page, and no longer attempts to click the 'continue to partner agency'
link. Route logic was out of scope and is handled in another pr

Move usps spec to features/saml

**Why**: It doesn't stub out the session and is more of an integration
test

Rebase with master, extend loa3 signup feature

**Why**: Get up-to-date with new code, make loa3 feature spec more
complete (follow user all the way from signup to their profile)

Remove links to pages being reworked/created

**Why**: They don't go anywhere yet
@el-mapache el-mapache force-pushed the ab-restyle-usps-confirmation branch from 8c49406 to 0dca6af Compare May 18, 2017 15:01
@el-mapache el-mapache merged commit 85b842a into master May 18, 2017
@el-mapache el-mapache deleted the ab-restyle-usps-confirmation branch May 18, 2017 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants